%%%-------------------------------------------------------------------
%%% @author kk
%%% @copyright (C) 2024, <COMPANY>
%%% @doc
%%%
%%% @end
%%% Created : 18. 7月 2024 14:33
%%%-------------------------------------------------------------------
-module(len2).
-author("kk").

%% API
-export([start/0,while/1,while/2]).

start() ->
  List = [1,3,4,5],
  Len = while(List),
  io:fwrite("~w", [Len]).

while(List) ->
  while(List, 0).

while([], Acc) ->
  Acc;

while([_ | List], Acc) ->
  while(List, Acc + 1).

